﻿@{
    ViewBag.Title = "Form";
    Layout = "~/Views/Shared/_ManufactureList.cshtml";
}
<style type="text/css">
    .ui-jqgrid .table-bordered th {  height: 52px !important; }
</style>
<script type="text/javascript">
    $(function () {
        initControl();
        gridList();
    });
    function initControl() {
        $('select').bindSelect();
    }
    function gridList() {
        var $gridList1 = $("#gridList1");
        var $gridList2 = $("#gridList2");
        $gridList1.dataGrid({
            url: "/BOM/Product/GetStampingListJson",
            height: $(window).height() - 134,
            colModel: [
                { label: '零件编号', name: 'FProductionNO', width: 120, align: 'left', sortable: false },
                { label: '零件名称', name: 'MC', width: 180, align: 'left', sortable: false },
                { label: '装配<br />路线', name: 'AssembleLine', width: 40, align: 'left', sortable: false },
                { label: '制造路线', name: 'MakeLine', width: 180, align: 'left', sortable: false },
                { label: '备注', name: '', width: 220, align: 'left', sortable: false }
            ],
            pager: "#gridPager1",
            sortname: 'FProductionNO asc',
            viewrecords: true,
            rownumWidth: 40,
            onSelectRow: function (rowid) {
                var rowData = $gridList1.jqGrid('getRowData', rowid);
                $gridList2.jqGrid('setGridParam', {
                    postData: { number: rowData.FProductionNO },
                }).trigger('reloadGrid');
            }
        });
        $("#btn_search").click(function () {
            $gridList1.jqGrid('setGridParam', {
                postData: { number: $("#txtNumber").val(), name: $("#txtName").val(), assemble: $("#txtAssemble").val(), make: $("#txtMake").val() },
            }).trigger('reloadGrid');
            $gridList2.jqGrid('setGridParam', {
                postData: { number: "" },
            }).trigger('reloadGrid');
        });
        
        $gridList2.dataGrid({
            url: "/BOM/Product/GetUsedAmountJson",
            height: $(window).height() - 89 - 16,
            colModel: [
                { label: '车型编号', name: 'ProductNO', width: 150, align: 'left', sortable: false },
                { label: '车型名称', name: 'MC', width: 250, align: 'left', sortable: false },
                { label: '用量', name: 'VALUE', width: 40, align: 'right', sortable: false },
            ],
            //pager: "#gridPager2",
            pgbuttons: false,
            rowNum: 100000,
            sortname: '',
            viewrecords: true,
            rownumWidth: 40
        });
        $gridList1.jqGrid('setLabel', 0, '序号', 'rowNumberHeaderStyle');
        $gridList2.jqGrid('setLabel', 0, '序号', 'rowNumberHeaderStyle');
    }
</script>
<div id="layout" style="height: 100%; width: 1353px; margin: 0 auto;">
    <div style="padding: 12px 0 5px 0; padding-left: 15px; border-bottom: 1px solid #ccc; " class="line-table input-width-105">
        <div class="btn-group" style="margin-top:-9px;">
            零件编号<br /><input id="txtNumber" name="txtNumber" type="text" class="form-control" /> &nbsp;
        </div>
        <div class="btn-group" style="margin-top:-9px;">
            零件名称<br /><input id="txtName" name="txtName" type="text" class="form-control input-width-185" /> &nbsp;
        </div>
        <div class="btn-group" style="margin-top:-9px;">
            装配路线<br /><input id="txtAssemble" name="txtAssemble" type="text" class="form-control input-width-40" /> &nbsp;
        </div>
        <div class="btn-group" style="margin-top:-9px;">
            制造路线<br /><input id="txtMake" name="txtMake" type="text" class="form-control" /> &nbsp;
        </div>
        <div class="btn-group" style="">
            <a id="btn_search" class="btn btn-primary center-block" onclick=""><span class="glyphicon glyphicon-search"></span> 检索</a>
        </div>
        <div class="btn-group" style="float:right;padding-right:10px;">
            <a id="" class="btn btn-primary center-block" onclick="$.reload()"><span class="glyphicon glyphicon-refresh"></span> 刷新</a>
            <a id="" class="btn btn-primary center-block disabled" onclick=""><span class="glyphicon glyphicon-download"></span> 导出</a>
        </div>
    </div>
    <div>
        <div style="width:59.5%;float:left;">
            <table id="gridList1"></table>
            <div id="gridPager1"></div>
        </div>
        <div style="width:40%;float:right;">
            <table id="gridList2"></table>
            <div id="gridPager2"></div>
        </div>
    </div>
</div>

